<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>机构管理</title>
    <%@ include file="../common/meta.jsp" %>
    <%@ include file="../common/common-body.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
    <style>
        .reasonCheckLabel{
            display: block;
        }
    </style>
    <script>
        var checkTypeList = ${checkTypeList};
        var checkResultTypeList = ${checkResultTypeList};
        var defOrgInfo = ${defOrgInfo};
    </script>
</head>
<body class="gray-bg">
<div id="vue">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-search"></i> 筛选查询</h5>
                    </div>
                    <div class="ibox-content ibox-content-search">
                        <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                            <div class="form-group">
                                <label class="col-sm-1 control-label">查询机构：</label>
                                <div class="col-sm-5">
                                    <input type="text" name="orgName" onkeydown="if(event.keyCode==13){doRefresh();return false;}" id="orgName" class="form-control"  placeholder="输入机构名称" maxlength="30"
                                           value="${not empty defOrgInfo ? defOrgInfo.orgName : ''}">
                                </div>
                                <label class="col-sm-1 control-label">数据来源：</label>
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <input type="hidden" id="isvPid" name="isvPid" value="${not empty defOrgInfo ? defOrgInfo.isvPid : ''}">
                                        <input type="text" id="isvName" name="isvName" class="form-control" placeholder="请输入数据来源" :value="orgObj.isvName">
                                        <div class="input-group-btn">
                                            <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                                <div class="ibox-tools ibox-tools-search">
                                    <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                    <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                    <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();"><i class="fa fa-caret-down"></i></button>
                                </div>
                            </div>
                            <div class="search-tools">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">发布状态：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="status" id="status" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${statusMap}" var="item">
                                                <option value="${item.key}" ${not empty defOrgInfo && defOrgInfo.status == item.key? 'selected' : '' } >${item.value}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">数据状态：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="dataStatus" id="dataStatus" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${dataStatusMap}" var="item">
                                                <c:if test="${item.key!='delete'}">
                                                    <option value="${item.key}" ${not empty defOrgInfo && defOrgInfo.dataStatus == item.key? 'selected' : '' } >${item.value}</option>
                                                </c:if>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">省份：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="province" id="province" onchange="doSelectCity()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${provinceMap}" var="item">
                                                <option value="${item.code}" ${not empty defOrgInfo && defOrgInfo.province == item.code? 'selected' : '' } >${item.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                    <label class="col-sm-1 control-label">城市：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="city" id="city" onchange="doRefresh()">
                                            <option value="">--请选择--</option>
                                            <c:forEach items="${cityMap}" var="item">
                                                <option value="${item.code}" ${not empty defOrgInfo && defOrgInfo.city == item.code? 'selected' : '' } >${item.name}</option>
                                            </c:forEach>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">合并标识：</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="isMerge" id="isMerge" onchange="doRefresh()">
                                            <option value="" ${not empty defOrgInfo && defOrgInfo.isMerge == '' ? 'selected' : '' }>--请选择--</option>
                                            <option value="0" ${not empty defOrgInfo && defOrgInfo.isMerge == 2 ? 'selected' : '' }>合并</option>
                                            <option value="1" ${not empty defOrgInfo && defOrgInfo.isMerge == 1 ? 'selected' : '' }>未合并</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i> 机构信息</h5>
                        <div class="ibox-tools col-sm-offset-2">
                            <c:if test="${userType == 'super' || not empty btnMap['addOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="openAddOrgPage()">新增</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['editOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="openEditOrgPage()">编辑</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['commitOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="doCommit()">提交发布</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['revokeOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="checkOrgRevoke()">撤销发布</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['delOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="checkOrgDelete()">删除</button>
                            </c:if>
                            <c:if test="${userType == 'super' || not empty btnMap['exportOrg']}">
                                <button class="btn btn-primary btn-outline" onclick="doExport()">导出</button>
                            </c:if>
                            <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class='table table-striped table-hover'
                               id="dataTable"  data-height="320"
                               data-toggle="table"
                               data-url="${ctx}/org/pageFindOrgData?t=${now}"
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getParams"
                               data-page-number="${not empty defOrgInfo.pageNo ? defOrgInfo.pageNo : 1}"
                               data-page-size="${not empty defOrgInfo.pageSize ? defOrgInfo.pageSize : defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="isvPid" data-visible="false">服务商pid</th>
                                <th data-field="orgCode" data-align="center" data-width="250px">机构ID</th>
                                <th data-field="status" data-formatter="formatStatus" data-align="center" data-width="100px">发布状态</th>
                                <th data-field="dataStatus" data-formatter="formatDataStatus" data-align="center" data-width="100px">数据状态</th>
                                <th data-field="orgName" data-formatter="formatName" data-events="actionEvents" data-align="center" data-width="200px">机构名称</th>
                                <th data-field="code" data-align="center" data-width="150px">原机构编码</th>
                                <th data-field="city" data-align="center" data-width="80px">所在城市</th>
                                <th data-field="orgCategoryStr" data-align="center" data-width="100px">机构类型</th>
                                <th data-field="orgCategory" data-visible="false">机构类型</th>
                                <th data-field="orgLevelStr" data-align="center" data-width="100px">等级</th>
                                <th data-field="orgLevel" data-visible="false">机构等级</th>
                                <th data-field="isvName" data-formatter="formatIsv" data-events="actionEvents" data-align="center" data-width="120px">来源</th>
                                <th data-field="orgMergeCode" data-align="center" data-width="250px">合并机构ID</th>
                                <th data-field="creator" data-formatter="formatterCreator" data-align="center" data-width="100px">创建人</th>
                                <th data-field="operator" data-formatter="formatterOperator" data-align="center" data-width="100px">编辑人</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><i class="fa fa-table"></i> 操作记录</h5>
                    </div>
                    <div class="ibox-content">
                        <table class='table table-striped table-hover'
                               id="recordTable"  data-height="320"
                               data-toggle="table"
                               <%--data-url="${ctx}/org/pageFindRecordData?t=${now}"--%>
                               data-pagination="true"
                               data-side-pagination="server"
                               data-striped="true"
                               data-response-handler="handleServerResult"
                               data-query-params-type=""
                               data-query-params="getRecordParams"
                               data-page-size="${defaultPageSize}"
                               data-page-list="${pageList}">
                            <thead>
                            <tr>
                                <th data-field="id" data-visible="false">主键id</th>
                                <th data-field="checkType" data-formatter="formatCheckType" data-align="center" data-width="120px">变更类型</th>
                                <th data-field="gmtPublish" data-align="center" data-width="140px">提交时间</th>
                                <th data-field="operatorCommit" data-align="center" data-width="90px">提交人</th>
                                <th data-field="remark" data-align="center">说明</th>
                                <th data-field="gmtCreate" data-align="center" data-width="140px">审核时间</th>
                                <th data-field="operator" data-align="center" data-width="90px">审核人</th>
                                <th data-field="result" data-formatter="formatResult" data-align="center" data-width="120px">审核结果</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="text-center">${companyName}</div>
            </div>
        </div>
    </div>

    <div id="setReasonPage" class="modal" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 id="_modelTitle" style="text-align: center; font-weight: normal;">撤销发布</h4>
                </div>
                <div class="modal-body modal-body-height">
                    <form class="form-horizontal m-t" id="_tipForm">
                        <div class="form-group">
                            <label class="col-sm-12 control-label" style="text-align: left;"><span style="color: red">*</span>请输入<span id="_modelTip">撤销发布</span>原因：</label>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12">
                                <c:forEach items="${reasonMap}" var="item">
                                    <label class="reasonCheckLabel"><input type="checkbox" name="_reason" value="${item.name}">${item.name}</label>
                                </c:forEach>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-12">
                                <textarea id="reason" name="reason" maxlength="1000" style="height: 100px; resize: none; width: 100%;"></textarea>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer" style="text-align: center;">
                    <button class="btn btn-primary" onclick="doSaveReason()">保存</button>
                    <button class="btn btn-white" onclick="closeSetReasonPage();">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="${ctx}/js/org/orgMgr.js?t=${now}"></script>
</body>
</html>

